<?php

namespace App\Http\Controllers\admin;

use App\Dao\ChatsDao;
use App\Services\Code;

class ChatsController extends BaseController
{
    public function chats()
    {
        if(getIsHasPage()){
            return  Code::message('',200,ChatsDao::chatsPageinate(request()->all()));
        }
        return view('admin.chats.chats');
    }

    public function del()
    {
        $params = request('id');
        ChatsDao::del([
            'chat_id'=>$params
        ]);
        return Code::message();
    }

    public function edit()
    {
        if(isPost()) {
            $params = request()->all();
            ChatsDao::editInfo($params);
            return  Code::message();
        }
        return view('admin.chats.edit',[
            'info'=>ChatsDao::info(request()->all())
        ]);
    }
}
